package com.opennice.soukaoti.paper.dao.impl;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.opennice.soukaoti.dao.BaseDAO;
import com.opennice.soukaoti.paper.dao.IPTitleDAO;
import com.opennice.soukaoti.vo.PTitle;

public class PTitleDAO extends BaseDAO implements IPTitleDAO {
	@Override
	public PTitle getPTitle(int ptId) {
		Session session = getSession();
		Transaction tx = session.beginTransaction();
		PTitle pTitle = (PTitle) session.load(PTitle.class, ptId);
		tx.commit();
		session.close();
		return pTitle;
	}
	@Override
	public void savePTitle(PTitle title) {
		Session session = getSession();
		Transaction tx = session.beginTransaction();
		session.save(title);
		tx.commit();
		session.close();
	}
	@Override
	public void updatePTitle(PTitle title) {
		Session session = getSession();
		Transaction tx = session.beginTransaction();
		session.update(title);
		tx.commit();
		session.close();
	}
}
